<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            position: absolute;
        }
    </style>
</head>
<body>
    <img src="./1.jpg" alt="">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script>
        // 在固定的时间内 最多执行一次
        var timer = null
        $(document).on("mousemove", function(event) {
            if(timer) return;
            timer = setTimeout(()=> {
                $("img").css({
                    top: event.pageY - $("img").height()/2,
                    left: event.pageX -  $("img").width()/2
                })

                timer = null;
            }, 20)
        })
    </script>
</body>
</html>